﻿using System.Data.Entity;
using Bricks.Data;

namespace Bricks.EntityFramework.Data
{

    /// <summary>
    /// 
    /// </summary>
    public class DbContextFacadeFactory : FacadeBase<DbContext>, IContextFacadeFactory
    {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="connectionString"></param>
        public DbContextFacadeFactory(string connectionString) :
            base(() => new DbContext(connectionString))
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public IContextFacade Create()
        {
            return Execute<IContextFacade>(dbConext => new DbContextFacade(dbConext));
        }
    }
}
